package top.lingma.handler;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import top.lingma.exception.LimitException;
import top.lingma.result.ApiResult;

/**
 * @author yui
 * @date 2019年05月20日 下午4:51
 */
@ControllerAdvice
public class LimitExceptionHandler {

    @ExceptionHandler(LimitException.class)
    @ResponseBody
    public ApiResult OverLimitExceptionHandler(LimitException e) {
        return ApiResult.builder().code(9999).msg(e.getMessage()).build();
    }
}
